package jrdcom.com.jrdmovie.Present;

import android.content.Context;

import jrdcom.com.jrdmovie.JrdHttpMethod.Beans.JrdMoveDetailBean;
import jrdcom.com.jrdmovie.JrdHttpMethod.JrdHttpMethod;
import jrdcom.com.jrdmovie.JrdHttpMethod.JrdSubscriber.JrdOnNextListener;
import jrdcom.com.jrdmovie.JrdHttpMethod.JrdSubscriber.ProgressSubscriber;

/**
 * Created by longcheng on 2017/3/28.
 */

public class JrdMovieDetailPresent implements JrdMovieDetailConstract.JrdMoviePresent{

    private Context mContext;
    private JrdMovieDetailConstract.JrdMovieView mMovieView;
    public JrdMovieDetailPresent(Context context){
        mContext = context;
    }

    private JrdOnNextListener<JrdMoveDetailBean> onNextListener = new JrdOnNextListener<JrdMoveDetailBean>() {
        @Override
        public void OnNext(JrdMoveDetailBean jrdMoveDetailBean) {
            //回调
            mMovieView.updateScreen(jrdMoveDetailBean);
        }
    };
    public void setView(JrdMovieDetailConstract.JrdMovieView view){
        mMovieView = view;
    }

    @Override
    public void getMovieDetail(String MovieId) {
        ProgressSubscriber<JrdMoveDetailBean> progressSubscriber = new ProgressSubscriber<JrdMoveDetailBean>(mContext, onNextListener);
        JrdHttpMethod.getInstance().getHttpMovieDetail(progressSubscriber,MovieId);
    }
}
